<?php

use Intervention\Image\ImageManagerStatic;
//返回json类型数据
//                          $code : : 自定义状态码
//                          $message  :: 状态提示信息
//                          $httpCode  :: http请求默认状态码
//                          $data  :: 传值
function toJson($code, $message = '', $httpCode = 200, $data = [])
{
    $jsonData['code'] = $code;
    if ($message) {
        $jsonData['message'] = $message;
    }
    if ($data) {
        $jsonData['data'] = $data;
    }

    return response()->json($jsonData, $httpCode);

}


